<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>获得有下拉列表的表单的ID</title>
</head>

<body>
    <form id="myForm">
        <select id="mySelect">
            <option>苹果</option>
            <option>梨子</option>
            <option>香蕉</option>
            <option>橙子</option>
        </select>
    </form>
    <p>form的ID为：
        <script>
            document.write(document.getElementById("mySelect").form.id);
        </script>
    </p>
</body>

</html>